from django.db import models
from django.contrib.auth.models import AbstractUser,UserManager
# Create your models here.
class MyManage(UserManager):
    def create_superuser(self, username, password,email=None, **extra_fields):
        return super().create_superuser(username=username,password=password,email=email,**extra_fields)

class User(AbstractUser):
    mobile=models.CharField(max_length=11,unique=True,help_text="手机号",error_messages={"unique":"手机号已经注册"})
    email_active=models.BooleanField(default=False)
    def __str__(self):
        return self.username
    class Meta:
        db_table='tb_prouser'
        verbose_name = '用户'
        verbose_name_plural =verbose_name

    objects = MyManage()
    REQUIRED_FIELDS = ['email']
